package com.net.xpay.core.domain;

import com.net.xpay.common.enums.user.CommissionMode;
import com.net.xpay.common.enums.user.ServicePayMode;
import com.net.common.domain.VersionedDomain;
import com.net.xpay.core.enums.PayTransBatchStatus;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

import java.math.BigDecimal;
import java.time.LocalDateTime;

/**
 * 2020/4/29 14:54

 * 导入的批次记录
 */
@Getter
@Setter
@NoArgsConstructor
public class PayTransBatch extends VersionedDomain {
    @ApiModelProperty(notes = "用户id")
    private Long userId;

    @ApiModelProperty(notes = "注册手机号")
    private String mobile;

    @ApiModelProperty(notes = "合伙人id")
    private Long partnerId;

    @ApiModelProperty(notes = "父级合伙人id")
    private Long fatherPartnerId;

    @ApiModelProperty(notes = "销售id")
    private Long salesmanId;

    @ApiModelProperty(notes = "免费 新用户测试送的 不扣钱")
    private Boolean free;

    @ApiModelProperty(notes = "是否是代转账")
    private Boolean otherTrans;

    @ApiModelProperty(notes = "转账执行人id")
    private Long executeUserId;

    @ApiModelProperty(notes = "转账执行人外部id")
    private String executeOuterId;

    @ApiModelProperty(notes = "转账执行人手机号")
    private String executeMobile;

    @ApiModelProperty(notes = "服务费是否已支付")
    private Boolean hasPayService;

    @ApiModelProperty(notes = "支付宝账号id")
    private Long alipayUserId;

    @ApiModelProperty(notes = "支付宝账号")
    private String alipayNickName;

    @ApiModelProperty(notes = "导入的商户的批次号 非必选")
    private String importBatchNo;

    @ApiModelProperty(notes = "支付宝发起支付后返回的 支付宝批次订单号")
    private String batchTransId;

    @ApiModelProperty(notes = "最后一次交易的汇总记录id")
    private Long lastSummaryId;

    @ApiModelProperty(notes = "最后一次发起的付款链接")
    private String lastPayUrl;

    @ApiModelProperty(notes = "最后一次发起的移动端付款链接")
    private String lastMobilePayUrl;

    @ApiModelProperty(notes = "生成的移动端付款二维码")
    private String mobilePayQrCode;

    @ApiModelProperty(notes = "上传的文件保存链接")
    private String fileUrl;

    @ApiModelProperty(notes = "文件过期时间")
    private LocalDateTime fileExpired;

    @ApiModelProperty(notes = "服务费 分")
    private Long servicePrice;

    @ApiModelProperty(notes = "服务费退款 分")
    private Long refund;

    @ApiModelProperty(notes = "收费模式")
    private ServicePayMode mode;

    @ApiModelProperty(notes = "分佣模式")
    private CommissionMode commissionMode;

    @ApiModelProperty(notes = "服务费收费比例")
    private BigDecimal serviceRatio;

    @ApiModelProperty(notes = "服务费单价 分")
    private Long serviceUnitPrice;

    @ApiModelProperty(notes = "平台实际服务费 分")
    private Long serviceRealPrice;

    @ApiModelProperty(notes = "批次总金额，单位为元，精确到小数点后两位，取值范围[0.01,9999999999999.99]  必选")
    private String totalTransAmount;

    @ApiModelProperty(notes = "批次总笔数 10 必选")
    private Long totalCount;

    @ApiModelProperty(notes = "成功金额 单位为元")
    private String successAmount;

    @ApiModelProperty(notes = "成功笔数")
    private Long successCount;

    @ApiModelProperty(notes = "失败金额")
    private String failedAmount;

    @ApiModelProperty(notes = "失败笔数")
    private Long failCount;

    @ApiModelProperty(notes = "转账标题，用于收银台展示标题 报销付款 必选")
    private String orderTitle;

    @ApiModelProperty(notes = "业务备注 非必选")
    private String remark;

    @ApiModelProperty("状态")
    private PayTransBatchStatus status;

    @ApiModelProperty(notes = "完成时间")
    private LocalDateTime endTime;

    @ApiModelProperty(notes = "绝对超时时间，格式为yyyy-MM-dd HH:mm。")
    private String timeExpire;

    /**
     * 分佣收益
     */
    @ApiModelProperty(notes = "一级合伙人单笔收益 分")
    private Long unitPartnerBenefit;

    @ApiModelProperty(notes = "二级合伙人单笔收益 分")
    private Long unitFatherPartnerBenefit;

    @ApiModelProperty(notes = "合伙人毛利润分佣比例")
    private BigDecimal benefitRatio;

    @ApiModelProperty(notes = "父合伙人毛利润分佣比例")
    private BigDecimal fatherBenefitRatio;

    @ApiModelProperty(notes = "服务费成本价收费比例")
    private BigDecimal costServiceRatio;

    @ApiModelProperty(notes = "一级合伙人总收益 分")
    private Long totalPartnerBenefit;

    @ApiModelProperty(notes = "二级合伙人总收益 分")
    private Long totalFatherPartnerBenefit;

    @ApiModelProperty(notes = "平台总收益 分")
    private Long totalPlatformBenefit;


    public static PayTransBatch getInstance() {
        PayTransBatch instance = new PayTransBatch();
        instance.setFree(false);
        instance.setHasPayService(false);
        instance.setOtherTrans(false);
        instance.setUnitPartnerBenefit(0L);
        instance.setUnitFatherPartnerBenefit(0L);
        instance.setTotalPartnerBenefit(0L);
        instance.setTotalFatherPartnerBenefit(0L);
        instance.setTotalPlatformBenefit(0L);
        instance.setRefund(0L);
        instance.setCostServiceRatio(new BigDecimal(0));
        instance.setCommissionMode(CommissionMode.FIXED_MODE);
        return instance;
    }

}
